package com.zenithsun.news.newsreview.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.syzg.common.service.impl.BaseServiceImpl;
import com.syzg.core.page.DefaultPageResult;
import com.syzg.core.page.PageResult;
import com.zenithsun.news.newsreview.model.NewsReview;
import com.zenithsun.news.newsreview.dao.NewsReviewDAO;
import com.zenithsun.news.newsreview.service.NewsReviewService;

@Service("newsReviewService")
public class NewsReviewServiceImpl extends BaseServiceImpl<NewsReview> implements NewsReviewService {
    
    private NewsReviewDAO newsReviewDao = null;

    @Resource
	public void setreviewDAO(NewsReviewDAO newsReviewDao) {
		this.setDAO(newsReviewDao);
		this.newsReviewDao = newsReviewDao;
	}

	@Override
	public PageResult queryReview(int pageNo, int pageSize,NewsReview searchCondition) throws Exception {
		int totalCount=this.newsReviewDao.countNewsReview(searchCondition);
		List items=this.newsReviewDao.listNewsReview(pageNo, pageSize, searchCondition);
		PageResult pageResult = new DefaultPageResult(items, totalCount, (pageNo - 1) * pageSize, pageSize);
		return pageResult;
	}

	@Override
	public NewsReview findNewsReview(String revId) throws Exception {
		return this.newsReviewDao.findNewsReview(revId);
	}
}
